/**
* ...
* @author Default
* @version 0.1
*/

package org.anivision.forms {

import flash.display.DisplayObjectContainer;
import org.aswing.*;
import org.aswing.border.*;
import org.aswing.geom.*;
import org.aswing.colorchooser.*;
import org.aswing.ext.*;
import org.aswing.JPanel;

/**
 * MainForm
 * 
 * @private
 */
public class MainForm  extends JPanel {
	
	//members define
	private var _top:JPanel;
	private var _mainMenu:JMenuBar;
	private var _file:JMenu;
	private var _file_new:JMenu;
	private var _file_open:JMenu;
	private var _save:JMenuItem;
	private var _saveall:JMenuItem;
	private var com47:JSeparator;
	private var _exit:JMenuItem;
	private var _tools:JTabbedPane;
	private var _body:JSplitPane;
	private var _prompt:PromptPanel;
	private var _docTab:JTabbedPane;
	private var _status:JPanel;
	private var _status_labels:JPanel;
	private var _ready:JLabel;
	private var _progress:JProgressBar;
	private var _owner:DisplayObjectContainer;
	
	/**
	 * Main Constructor
	 */
	public function MainForm(owner:DisplayObjectContainer) {
		this._owner = owner;
		this.setOpaque(true);
		//component creation
		setSize(new IntDimension(400, 400));
		var layout0:BorderLayout = new BorderLayout();
		layout0.setVgap(1);
		setLayout(layout0);
		
		_top = new JPanel();
		_top.setSize(new IntDimension(400, 400));
		_top.setConstraints("North");
		var layout1:SoftBoxLayout = new SoftBoxLayout();
		layout1.setAxis(1);
		layout1.setAlign(1);
		_top.setLayout(layout1);
		
		_mainMenu = new JMenuBar();
		_mainMenu.setSize(new IntDimension(35, 17));
		var border2:BevelBorder = new BevelBorder();
		border2.setBevelType(0);
		border2.setThickness(1);
		_mainMenu.setBorder(border2);
		
		_file = new JMenu();
		_file.setName("File");
		_file.setText("File");
		
		_file_new = new JMenu();
		_file_new.setText("New");

		_file_open = new JMenu();
		_file_open.setText("Open");
				
		_save = new JMenuItem();
		_save.setText("&Save");
		
		_saveall = new JMenuItem();
		_saveall.setText("Save &All");
		
		com47 = new JSeparator();
		
		_exit = new JMenuItem();
		_exit.setText("E&xit");
		
		_tools = new JTabbedPane();
		_tools.setSize(new IntDimension(300, 300));
		_tools.setConstraints("Center");
		var border3:BevelBorder = new BevelBorder();
		border3.setBevelType(1);
		border3.setThickness(1);
		_tools.setBorder(border3);
		
		_prompt = new PromptPanel(this._owner);
		_body = new JSplitPane(AsWingConstants.VERTICAL);
		_body.setDividerSize(5);
		_body.setDividerLocation(600);
		_body.setResizeWeight(1);
		_body.setConstraints("Center");
		
		_docTab = new JTabbedPane();
		_docTab.setOpaque(false);
		_docTab.setConstraints("Center");
		_docTab.setTabPlacement(1);
		
		_status = new JPanel();
		_status.setSize(new IntDimension(400, 400));
		_status.setConstraints("South");
		var border4:BevelBorder = new BevelBorder();
		border4.setBevelType(1);
		border4.setThickness(1);
		_status.setBorder(border4);
		var layout5:BorderLayout = new BorderLayout();
		_status.setLayout(layout5);
		
		_status_labels = new JPanel();
		_status_labels.setSize(new IntDimension(400, 400));
		_status_labels.setConstraints("West");
		var layout6:FlowLayout = new FlowLayout();
		layout6.setAlignment(2);
		layout6.setHgap(2);
		layout6.setMargin(false);
		_status_labels.setLayout(layout6);
		
		_ready = new JLabel();
		var border7:BevelBorder = new BevelBorder();
		border7.setBevelType(1);
		border7.setThickness(1);
		_ready.setBorder(border7);
		_ready.setText("Ready");
		
		_progress = new JProgressBar();
		_progress.setConstraints("Center");
		_progress.setOrientation(0);
		_progress.setValue(0);
		_progress.setMinimum(0);
		_progress.setMaximum(100);
		
		//component layoution
		append(_top);
		append(_body);
		append(_status);
		
		_top.append(_mainMenu);
		_top.append(_tools);
		
		_mainMenu.append(_file);
		
		_file.append(_file_new);
		_file.append(_file_open);
		_file.append(_save);
		_file.append(_saveall);
		_file.append(com47);
		_file.append(_exit);

		_body.append(_docTab);
		_body.append(_prompt);

		_status.append(_status_labels);
		_status.append(_progress);
		
		_status_labels.append(_ready);
		
	}
	
	public function init():void {
		_prompt.init();
	}
	
	//_________getters_________
	
	
	public function get_mainMenu():JMenuBar{
		return _mainMenu;
	}
	
	public function get_file():JMenu{
		return _file;
	}
	
	public function get_file_new():JMenu {
		return _file_new;
	}
	public function get_file_open():JMenu{
		return _file_open;
	}
		
	public function get_save():JMenuItem{
		return _save;
	}
	
	public function get_saveall():JMenuItem{
		return _saveall;
	}
	
	
	public function get_exit():JMenuItem{
		return _exit;
	}
	
	public function get_tools():JTabbedPane{
		return _tools;
	}
	
	public function get_docTab():JTabbedPane{
		return _docTab;
	}
	
	
	public function get_status_labels():JPanel{
		return _status_labels;
	}
	
	public function get_ready():JLabel{
		return _ready;
	}
	
	public function get_progress():JProgressBar{
		return _progress;
	}
}
}